﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ruleweaver.Rules.CheckMethods;

namespace Ruleweaver.Annotation
{
	public sealed class CheckIsBetweenAttribute : CheckAttribute
	{
		public CheckIsBetweenAttribute(object minimum, object maximum)
		{
			Minimum = minimum;
			Maximum = maximum;
		}

		public CheckIsBetweenAttribute(object minimum, object maximum, BoundaryType boundaryType) : this(minimum, maximum)
		{
			BoundaryType = boundaryType;
		}

		public object Minimum { get; private set; }

		public object Maximum { get; private set; }

		public BoundaryType? BoundaryType { get; private set; }

		protected override ICheckMethod GetCheckMethod()
		{
			return BoundaryType == null ? new IsBetweenMethod(Minimum, Maximum) : new IsBetweenMethod(Minimum, Maximum, BoundaryType.Value);
		}
	}
}